100048bmalloc_var). End of main looks like this:
FUN_10008370((ulonglong *)"Well since you\'re here anyway have a flag:\n%s\n",
(ulonglong)malloc_var,param_3,param_4,param_5,param_6,param_7,
"_s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (&zone_names[info->idx]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (&zone_names[info->idx]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (__tzname[tp->tm_isdst]) && ((size_t)(const void *)((__tzname[tp->tm_isdst]) + 1) - (size_t)(const void *)(__tzname[tp->tm_isdst ]) == 1) && (__s2_len = strlen (__tzname[tp->tm_isdst]), __s2_len < 4) ? (__builtin_c onstant_p (&zone_names[info->idx]) && ((size_t)(const void *)((&zone_names[info->idx] ) + 1) - (size_t)(const void *)(&zone_names[info->idx]) == 1) ? __builtin_strcmp (&zo ne_names[info->idx], __tzname[tp->tm_isdst]) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (&zone_names[info->idx]); register int __result = __s1[0] - ((const unsigned char *) (const char *) (__tzname[tp->tm_isdst] ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned ch ar *) (const char *) (__tzname[tp->tm_isdst]))[1]); if (__s2_len > 1 && __result == 0 ) { __result = (__s1[2] - ((const unsigned char *) (const char *) (__tzname[tp->tm_is dst]))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (__tzname[tp->tm_isdst]))[3]); } } __result; }))) : __builtin _strcmp (&zone_names[info->idx], __tzname[tp->tm_isdst])))); }) == 0"
);malloc_var, I'm guessing that's going to have the flag (or right sequence of bytes to produce the flag inside the function), where it will be printed out. I looked through the function at 10008370, and it calls another huge function that is an absolute mess that I don't want to analyze just staticallyqemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction$ file main
main: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, not strippedqemu string in there at all, but I do see GCC: (Cavium Inc. Version: SDK_BUILD build 52) 4.7.0static const char configuration_arguments[] = "/usr/local/Cavium_Networks/octsw/toolchain/scripts/../src/configure --disable-fixed-point --without-ppl --without-python --disable-werror --with-lto-plugin-source=/usr/local/Cavium_Networks/octsw/toolchain/scripts/../gits/gcc/lto-plugin --enable-64-bit-bfb --enable-plugins --with-sysroot --with-local-prefix=/usr/local/Cavium_Networks/octsw/toolchain/scripts/../tools/mips64-octeon-linux-gnu/sys-root --disable-sim --enable-symvers=gnu --enable-__cxa_atexit --enable-symvers=gnu --enable-__cxa_atexit --with-mips-plt --disable-sim --target=mips64-octeon-linux-gnu --enable-languages=c,c++ --prefix=/usr/local/Cavium_Networks/octsw/toolchain/scripts/../tools --with-pkgversion='Cavium Inc. Version: SDK_BUILD build 52' --with-bugurl=http://www.cavium.com/support.html --with-libexpat-prefix=/usr/local/Cavium_Networks/octsw/toolchain/scripts/../libs";
static const char thread_model[] = "posix";
static const struct {
const char *name, *value;
} configure_default_options[] = { { "llsc", "llsc" }, { "mips-plt", "plt" }, { "synci", "no-synci" } };.h file, and is linked to 2 different .o librariesqemu-system-mips64 binary, it breaks because it's defined twice.c file and only keep declaration in the header file, but then idk how to ensure that .c file is included right#include <file.h> in itfile.h had declaration in both# get qemu-1.0.1 and install
wget https://download.qemu.org/qemu-1.0.1.tar.gz
tar -xf qemu-1.0.1.tar.gz
cd qemu-1.0.1
export CFLAGS='-lm -lrt'
sudo apt install libglib2.0-dev # required dependency
./configure --target-list=mips64-softmmu --python=$(which python2)
make
# added the line `#include <sys/sysmacros.h>` to `hw/9pfs/virtio-9p.c`
# patch from outside the qemu directory
cd ..
wget https://raw.githubusercontent.com/amir-mehmood/QEMU-Octeon-MIPS64/master/host.patch
patch -p1 < host.patch
# at this point, there will be several times where you will have to specify the file because of weird parsing issues I don't understand, but it will display the filename and ask "what filename" and you just gotta paste it
# now, you have to manually create `hw/mips_octeon.c` because somehow it's gone. You can get the content from the patch file, just delete the + symbol at the beginning of each sign
make # this will fail for the reason we went overmake worked, we could've run it